package com.meilele.dao.hongdian;

import com.meilele.entity.hongdian.ThiLables;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ThiLablesMapper {
    @Insert({
        "insert into thi_lable (case_id, lable_id)",
        "values (#{caseId,jdbcType=INTEGER}, #{lableId,jdbcType=INTEGER})"
    })
    int insert(ThiLables record);

    int insertSelective(ThiLables record);

    @Results(value = {
            @Result(column = "case_id" , property = "caseId"),
            @Result(column = "lable_id" , property = "lableId")
    })
    @Select("SELECT lable_id FROM thi_lable WHERE case_id = #{caseId}")
    List<ThiLables> findLablesId(int caseId);

    @Delete("delete from thi_lable where case_id = #{caseId}")
    int deleteLables(int caseId);

    @Update("UPDATE thi_lable SET \n" +
            "case_id = #{caseId}, lable_id = #{lableId} WHERE case_id = #{caseId}")
    int updateLables(int caseId);
}